home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 44 / PC Actual CD 44.iso / Linux / Cygwin / full.exe / Disk1 / data1.cab / Tools / share / tix4.1 / SHList.tcl < prev    next >
Encoding:
Text File  |  1998-12-04  |  3.9 KB  |  156 lines

  1. # SHList.tcl --
  2. #
  3. #    This file implements Scrolled HList widgets
  4. #
  5. # Copyright (c) 1996, Expert Interface Technologies
  6. #
  7. # See the file "license.terms" for information on usage and redistribution
  8. # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  9. #
  10.  
  11. tixWidgetClass tixScrolledHList {
  12.     -classname TixScrolledHList
  13.     -superclass tixScrolledWidget
  14.     -method {
  15.     }
  16.     -flag {
  17.      -highlightbackground -highlightcolor -highlightthickness
  18.     }
  19.     -configspec {
  20.     {-highlightbackground -highlightBackground HighlightBackground #d9d9d9}
  21.     {-highlightcolor -highlightColor HighlightColor black}
  22.     {-highlightthickness -highlightThickness HighlightThickness 2}
  23.     }
  24.     -default {
  25.     {.scrollbar            auto}
  26.     {*f1.borderWidth        1}
  27.     {*hlist.Background        #c3c3c3}
  28.     {*hlist.highlightBackground    #d9d9d9}
  29.     {*hlist.relief            sunken}
  30.     {*hlist.takeFocus        1}
  31.     {*Scrollbar.background        #d9d9d9}
  32.     {*Scrollbar.troughColor        #c3c3c3}
  33.     {*Scrollbar.takeFocus        0}
  34.     {*Scrollbar.relief        sunken}
  35.     {*Scrollbar.width        15}
  36.     }
  37.     -forcecall {
  38.     -highlightbackground -highlightcolor -highlightthickness
  39.     }
  40. }
  41.  
  42. proc tixScrolledHList:ConstructWidget {w} {
  43.     upvar #0 $w data
  44.     global tcl_platform
  45.  
  46.     tixChainMethod $w ConstructWidget
  47.  
  48.     set data(pw:f1) \
  49.     [frame $w.f1 -takefocus 0]
  50.     set data(w:hlist) \
  51.     [tixHList $w.f1.hlist -bd 0 -takefocus 1 -highlightthickness 0]
  52.  
  53.     pack $data(w:hlist) -in $data(pw:f1) -expand yes -fill both -padx 0 -pady 0
  54.  
  55.     set data(w:hsb) \
  56.     [scrollbar $w.hsb -orient horizontal -takefocus 0]
  57.     set data(w:vsb) \
  58.     [scrollbar $w.vsb -orient vertical -takefocus 0]
  59.  
  60.     if {$data(-sizebox) && $tcl_platform(platform) == "windows"} {
  61.         set data(w:sizebox) [ide_sizebox $w.sizebox]
  62.     }
  63.  
  64.     set data(pw:client) $data(pw:f1)
  65. }
  66.  
  67. proc tixScrolledHList:SetBindings {w} {
  68.     upvar #0 $w data
  69.  
  70.     tixChainMethod $w SetBindings
  71.  
  72.     $data(w:hlist) config \
  73.     -xscrollcommand "$data(w:hsb) set"\
  74.     -yscrollcommand "$data(w:vsb) set"\
  75.     -sizecmd "tixScrolledWidget:Configure $w"
  76.  
  77.     $data(w:hsb) config -command "$data(w:hlist) xview"
  78.     $data(w:vsb) config -command "$data(w:hlist) yview"
  79.  
  80. }
  81.  
  82. #----------------------------------------------------------------------
  83. #
  84. #        option configs
  85. #----------------------------------------------------------------------
  86. proc tixScrolledHList:config-takefocus {w value} {
  87.     upvar #0 $w data
  88.   
  89.     $data(w:hlist) config -takefocus $value
  90. }    
  91.  
  92. proc tixScrolledHList:config-highlightbackground {w value} {
  93.     upvar #0 $w data
  94.  
  95.     $data(pw:f1) config -highlightbackground $value
  96. }
  97.  
  98. proc tixScrolledHList:config-highlightcolor {w value} {
  99.     upvar #0 $w data
  100.  
  101.     $data(pw:f1) config -highlightcolor $value
  102. }
  103.  
  104. proc tixScrolledHList:config-highlightthickness {w value} {
  105.     upvar #0 $w data
  106.  
  107.     $data(pw:f1) config -highlightthickness $value
  108. }
  109.  
  110.  
  111. #----------------------------------------------------------------------
  112. #
  113. #        Widget commands
  114. #----------------------------------------------------------------------
  115.  
  116. #----------------------------------------------------------------------
  117. #
  118. #        Private Methods
  119. #----------------------------------------------------------------------
  120. # virtual
  121. #
  122. proc tixScrolledHList:RepackHook {w} {
  123.     upvar #0 $w data
  124.  
  125. if 0 {
  126.     if [tixGetBoolean [$data(w:hlist) cget -header]] {
  127.     set data(vsbPadY) [winfo height $data(w:hlist).tixsw:header]
  128.     } else {
  129.     set data(vsbPadY) 0
  130.     }
  131.  
  132.     puts $data(vsbPadY)\ $data(w:hlist).tixsw:header
  133. }
  134.     tixChainMethod $w RepackHook
  135. }
  136. #----------------------------------------------------------------------
  137. # virtual functions to query the client window's scroll requirement
  138. #----------------------------------------------------------------------
  139. proc tixScrolledHList:GeometryInfo {w mW mH} {
  140.     upvar #0 $w data
  141.  
  142.     set extra [expr [$w.f1 cget -bd]+[$w.f1 cget -highlightthickness]]
  143.  
  144.     set mW [expr $mW - $extra*2]
  145.     set mH [expr $mH - $extra*2]
  146.  
  147.     if {$mW < 1} {
  148.     set mW 1
  149.     }
  150.     if {$mH < 1} {
  151.     set mH 1
  152.     }
  153.  
  154.     return [$data(w:hlist) geometryinfo $mW $mH]
  155. }
  156.